<template>
	<div style="display: inline-block;position: relative;" @click.stop="onClickHandler">
		<van-icon name="comment-o" /><a class="link-record"
			@click.stop="onClickHandler">{{componentModel.labelExpression}}(1)</a>
	</div>
</template>

<script>
	import utils from '@/utils/utils.js';
	import formDesignerUtil from '@/utils/formDesignerUtil.js';
	export default {
		name: "DesignLinkRecordComponent",
		props: [
			"componentModel"
		],
		beforeMount() {
			if (this.componentModel.labelExpression == undefined) {
				formDesignerUtil.setComponentModelCommonValue(this.componentModel,"labelExpression", "销售订单");
			}
		},
		data() {
			return {
				selected: false,
				"propertySet": [{
						"key": "ID",
						"label": "ID",
						"editor": "label"
					},
					{
						"key": "labelExpression",
						"label": "标签",
						"editor": "text"
					}, {
						"key": "refPageCode",
						"label": "页面",
						"editor": "text"
					}
				]
			}
		},
		inject: ['children'],
		mounted() {
			this.children.push(this);
		},beforeUnmount() {
			utils.removeArrayElement(this.children,this);
		},
		methods: {
			onClickHandler() {
				formDesignerUtil.mobileComponentClickHandler(this);
			},
			getPropertyValue(propertyKey) {
				if(propertyKey=="ID"){
					return formDesignerUtil.getComponentModelPropValue(this.componentModel,"id");
				}else if(propertyKey=="labelExpression"){
					return formDesignerUtil.getComponentModelPropValue(this.componentModel,"labelExpression");
				}
				return formDesignerUtil.getComponentModelCommonValue(this.componentModel,propertyKey);
			},
			setPropertyValue(propertyKey, propertyValue) {
				formDesignerUtil.setComponentModelCommonValue(this.componentModel,propertyKey, propertyValue);
				if(propertyKey=="labelExpression"){
					formDesignerUtil.setComponentModelPropValue(this.componentModel,"labelExpression",propertyValue);
				}
			},
			setSelected(selected) {
				this.selected = selected;
			}
		}
	}
</script>

<style>
</style>
